package org.soria.getinfo.panels;

import org.soria.getinfo.utils.InfoUtil;
import org.soria.getinfo.utils.PanelUtil;

import javax.swing.*;
import java.util.Map;

public class CPUPanel extends JPanel {
    private static final Map<String, String> cpuInfo = InfoUtil.CPU;
    public CPUPanel() {
        this.setLayout(null);
        this.setBorder(PanelUtil.createBorder("CPU信息"));
        // 名称
        JLabel cpuNameLabel = PanelUtil.createLabel("CPU名称：",15,30);
        this.add(cpuNameLabel);
        JLabel cpuName = PanelUtil.createInfoLabel(cpuInfo.get("CPU_name"),115,30,400);
        this.add(cpuName);
        // 数量
        JLabel cpuPackagesLabel = PanelUtil.createLabel("CPU数量：",15,50);
        this.add(cpuPackagesLabel);
        JLabel cpuPackages = PanelUtil.createInfoLabel(cpuInfo.get("CPU_package"),115,50,400);
        this.add(cpuPackages);
        // 核心数
        JLabel cpuCoresLabel = PanelUtil.createLabel("CPU核心数：",15,70);
        this.add(cpuCoresLabel);
        JLabel cpuCores = PanelUtil.createInfoLabel(cpuInfo.get("CPU_physical"),115,70,400);
        this.add(cpuCores);
        // 线程数
        JLabel cpuThreadsLabel = PanelUtil.createLabel("CPU线程数：",15,90);
        this.add(cpuThreadsLabel);
        JLabel cpuThreads = PanelUtil.createInfoLabel(cpuInfo.get("CPU_logical"),115,90,400);
        this.add(cpuThreads);
    }
}
